#include <stdio.h>

void swap(int *a, int *b)
{
    int t = *a;
    *a = *b, *b = t;
}

void moveZeroes(int *nums, int numsSize)
{
    int left = 0, right = 0;
    while (right < numsSize)
    {
        if (nums[right])
        {
            swap(nums + left, nums + right);
            left++;
        }
        right++;
    }
}

int main()
{
    int nums[] = {0, 1, 0, 12};
    int numsSize = sizeof(nums) / sizeof(nums[0]);
    moveZeroes(nums, numsSize);
    for(int i = 0;i < numsSize;i++)
        printf("%d ",nums[i]);
    printf("\n");
    return 0;
}
